# include<bits/stdc++.h>
using namespace std;

typedef long long ll;


bool isupper(char x)
{
    return x >= 'A' && x <= 'Z';
}
bool islower(char x)
{
    return x >= 'a' && x <= 'z';
}
bool isnum(char x)
{
    return x >= '0' && x <= '9';
}

int main()
{
    string str;
    ll cnt = 0, len = 0;
    set<string> s;
    getline(cin, str);

    while (str != "")
    {
        for (int i = 0; i < str.size(); ++i)
        {
            bool f1 = false, f2 = false, f3 = false;
            int j = i, t = 0;
            string tmp;
            while (isupper(str[j]) || islower(str[j]) || isnum(str[j]))
            {
                tmp += str[j];
                if (isupper(str[j]))    f1 = true;
                if (islower(str[j]))    f2 = true;
                if (isnum(str[j]))       f3 = true;
                j++, t++;
            }
            s.insert(tmp);
            i += t, len += t;
            if (f1 && f2 && f3)    cnt += 5;
            else if ((f1 && f3) || (f2 && f3))    cnt += 3;
            else if (f1 && f2)    cnt += 1;
        }
        getline(cin, str);
    }
    cout << endl;
    cout << cnt << endl;
    cout << len << " " << s.size();
    return 0;
}